<?php
function itx_get_option($opt,$i=false){
    if ($ret=get_option('itx_'.$opt)){
        if(!$i) return $ret;
        elseif (is_object($ret)&&isset($ret->$i)) return $ret->$i;
        elseif (isset($ret[$i])) return $ret[$i];
        else return itx_default_option($opt,$i);
    } else return itx_default_option($opt,$i);
}

function itx_update_option($opt,$value,$i=false){
    if ($i) {
	$fval=get_option('itx_'.$opt);
	$fval[$i]=$value;
	$value=$fval;
    }
    update_option('itx_'.$opt,$value);
}

function itx_default_option($opt,$i=false){
    switch ($opt){
    case'header':
        $ret=array(
            'head_type'=>1,
            'image'=>'',
            'repeat'=>'no-repeat',
            'position'=>'center',
            'color'=>'#ffffff',
            'hover_color'=>'#ddeeee',
            'span_color'=>'#eeffff',
            'bgcolor'=>'#000044',
            'text_align'=>'left',
            'scope'=>'1',
            'font_size'=>'3.5em',
            'span_font_size'=>'1.8em',
        );
        break;
    case'bg':
        $ret=array(
	    'image'=>'',
            'attachment'=>'scroll',
            'repeat'=>'no-repeat',
            'bgcolor'=>'',
            'v_align'=>'top',
            'h_align'=>'center',
            'resize'=>'100',
        );
        break;
   case'links':
        $ret=array(
            'rss'=>get_bloginfo('rss2_url'),
            'crss'=>get_bloginfo('comments_rss2_url'),
			'twitter'=>'itx_',
            'facebook'=>'pages/Calotropis-Theme/126125400731417',
			'plurk'=>'',
        );
         break;
    case'front':
        $ret=array(
            'type'=>'fe',
            'column'=>4,
            'featuredlim'=>50,
            'excerptlim'=>20,
            'featuredx'=>450,
            'featuredy'=>300,
            'thumbx'=>150,
            'thumby'=>100,
            'catch'=>1,
			'not'=>1,
			'fnotimg'=>'',
			'notimg'=> '',
        );
         break;
    case'menu':
        $ret=array(
			'wp_menu'=>1,
            'home'=>'Home',
            'depth'=>'0',
            'cat_inc'=>array(),
            'cat_sortby'=>'name',
            'cat_order'=>'ASC',
            'page_inc'=>array(),
            'page_sortby'=>'post_title',
            'page_order'=>'ASC',
            'show'=>'cat'
        );
        break;
    case'vars':
        $ret=(object)array(
            'data'=>'<div id="footerright"><strong><a href="http://calotropis.itx.web.id/">Calotropis</a></strong> theme by <a href="http://itx.web.id/">itx</a></div></div></div></div>',
        );
        break;
    case'layout':
        $ret=array(
            'column'=>21,
            'wrap'=>'1000',
            'wrapping'=>'fixed',
            'sidebar'=>'300',
            'sidebarunit'=>'px',
			'style'=>'',
            'innertop'=>2,
            'innerbottom'=>2,
            'footer'=>4,
        );
        break;
    case'misc':
        $ret=array(
            'favicon'=> get_bloginfo('template_directory').'/images/favicon.ico'
        );
        break;
    }
        
    if($i) {
        if (is_object($ret)) return $ret->$i;
        else return $ret[$i];
    }
    else return $ret;
}


?>